package com.yunupmall.mapper.commoditymapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunupmall.api.fordentity.Kind;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface KindMapper extends BaseMapper<Kind> {
    //查询一级类别
    @Select("select * from kind")
    List<Kind> getKindName();

    //查询一级类别
    @Select("select * from kind where upname is null")
    List<Kind> getKindnull();

    //添加商品类别
    @Insert("insert into kind(k_name,upname,k_rank,image)values(#{kName},#{upName},#{rank},#{image})")
    int AddKind(@Param("kName") String kName, @Param("upName") String upName, @Param("rank") Integer rank, @Param("image") String image);

    @Select("select * from kind limit #{this},#{page}")
    List<Kind> getAllKindData(@Param("this") Integer thissize, @Param("page") Integer page);

    @Select("select count(*) counts from kind")
    int getAllCounts();

    //删除类别
    @Delete("delete from kind where id=#{id}")
    int DeleteKindData(Integer id);
}